package com.kitchen.ui.controls.account
{
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;

	public class ExpBar extends Sprite
	{
		private var mainSkin:BitmapData
		private var shop:Object;
		private var process:ExpProcess;
		private var extTf:TextField;
		private var levelExp:int;
		
		public function ExpBar(main:BitmapData, shop:Object)
		{
			super();
			this.mainSkin = main;
			this.shop = shop;
			this.levelExp = 1000;
			this.layout();
		}
		
		private function layout():void{
			var bg:ExpIcon = new ExpIcon(this.mainSkin);
			this.addChild(bg);
			this.process = new ExpProcess(this.mainSkin, this.shop.shop.nExp/1000);
			this.process.x = 32;
			this.process.y = 6;
			this.addChild(this.process);
			this.extTf = new TextField();
			this.extTf.width = 60;
			this.extTf.selectable = false;
			var tff:TextFormat = new TextFormat();
			tff.align = TextFormatAlign.CENTER;
			tff.font = '黑体';
			tff.color = 0xffffff;
			tff.size = 12;
			tff.bold = true;
			this.extTf.defaultTextFormat = tff;
			this.extTf.text = this.shop.shop.nExp+'';
			this.extTf.y = 5;
			this.extTf.x = 42;
			this.addChild(this.extTf);
		}
		
		public function show(exp:int, levExp:int=0):void{
			if(levExp == 0){
				this.levelExp = levExp;
			}
			this.process.show(exp/this.levelExp);
		}
		
	}
}